import React, { Component } from 'react'

// npm i echarts -S

export default class Ref extends Component {
    state = {
        dom: null
    }
    render() {
        return (
            <div>
                {/* 操作Dom */}
                {/* 1. ref="字符串" */}
                {/* <input ref="ipt"/> */}
                {/* 2. ref="函数"  dom在函数的参数中 */}
                <input ref={(dom) => {
                    this.state.dom = dom
                    // this.setState({
                    //     dom
                    // })
                }}/>
            </div>
        )
    }
    componentDidMount() {
        console.log(this.state.dom)
        // this.refs.ipt.focus()
    }
}
